package logic

import (
	"context"
	"zk3/common/proto/user"
	"zk3/rpc/server"
)

type UserRegister struct {
	user.UnimplementedUserServer
}

func (u UserRegister) Reg(ctx context.Context, in *user.RegRequest) (*user.RegResponse, error) {
	reg, err := server.Reg(in)
	if err != nil {
		return nil, err
	}
	return reg, nil
}

func (u UserRegister) Login(ctx context.Context, in *user.LoginRequest) (*user.LoginResponse, error) {
	login, err := server.Login(in)
	if err != nil {
		return nil, err
	}
	return login, nil
}

func (u UserRegister) List(ctx context.Context, in *user.ListRequest) (*user.ListResponse, error) {
	list, err := server.List(in)
	if err != nil {
		return nil, err
	}
	return list, nil
}

func (u UserRegister) UserWorkCreate(ctx context.Context, in *user.UserWorkCreateRequest) (*user.UserWorkCreateResponse, error) {
	create, err := server.UserWorkCreate(in)
	if err != nil {
		return nil, err
	}
	return create, nil
}

func (u UserRegister) UserGiveCreate(ctx context.Context, in *user.UserGiveCreateRequest) (*user.UserGiveCreateResponse, error) {
	create, err := server.UserGiveCreate(in)
	if err != nil {
		return nil, err
	}
	return create, nil
}

func (u UserRegister) UserGiveDel(ctx context.Context, in *user.UserGiveDelRequest) (*user.UserGiveDelResponse, error) {
	del, err := server.UserGiveDel(in)
	if err != nil {
		return nil, err
	}
	return del, nil
}

func (u UserRegister) UserCommentCreate(ctx context.Context, in *user.UserCommentCreateRequest) (*user.UserCommentCreateResponse, error) {
	create, err := server.UserCommentCreate(in)
	if err != nil {
		return nil, err
	}
	return create, nil
}
